//引入请求函数
import { http } from "@/utils/http";

//引入类型约束
import type { addressResponse } from "@/types/address";
type id = {id:string};

//获取用户收货地址列表
export const reqUserAddress = () => {
    return http<addressResponse[]>({
        url:"/member/address",
        method:"GET"
    })
}

//获取用户收货地址详情
export const reqUserAddressDetail = (id:string) => {
    return http<addressResponse>({
        url:"/member/address" + "/" + id,
        method:"GET"
    })
}

//删除用户的一个收货地址
export const reqDeleteUserAddress = (id:string) => {
    return http<id>({
        url:"/member/address" + "/" + id,
        method:"DELETE"
    })
}

//添加用户的一个收货地址
export const reqAddUserAddress = (address:addressResponse) => {
    return http<id>({
        url:"/member/address",
        method:"POST",
        data:address
    })
}

//修改用户的一个收货地址
export const reqUpdateUserAddress = (id:string,address:addressResponse) => {
    return http<id>({
        url:"/member/address" + "/" + id,
        method:"PUT",
        data:address
    })
}